<include file="header" />
<body>
<div class="wraper margin-none">
    <div class="top">
        <a href="javascript:history.go(-1);" class="iconfont icon-zuo pull-left"></a>
        <span class="pull-left">低电量提醒设置</span>
	    <if condition="$data">
        <a href="{BEESCRM::U('base/ips/elereminddel',array('ips_id'=>$ips_id))}" class="iconfont icon-shanchu pull-right text-right"></a>
		<else/>
		</if>
    </div>
	<if condition="$data">

    <div class="container">
	    <volist name="data" id="vo">
            <p class="lists" >{BEESCRM:$vo.community_name} {BEESCRM:$vo.building_name} {BEESCRM:$vo.floor_name} {BEESCRM:$vo.room_name}
	            <span data-floow="{BEESCRM:$vo.floow_id}" data-status="{BEESCRM:$vo.status}" class="iconfont <if condition="$vo.status eq 0">icon-controler<else/>icon-guanbi</if>"  ></span>
            </p>
	    </volist>
    </div>
		<a href="{BEESCRM::U('base/ips/eleremindadd',array('ips_id'=>$ips_id))}" class="lists text-center text-blue">
			<span class="iconfont icon-jia"></span> 添加低电量提醒<if condition="$ips_id eq 9">商户<else/>寝室</if></a>
   <else/>
		<!--未设置-->
		<a href="{BEESCRM::U('base/ips/eleremindadd',array('ips_id'=>$ips_id))}" class="addsetting text-center text-blue"><span class="iconfont icon-jia"></span>
			添加低电量提醒<if condition="$ips_id eq 9">商户<else/>寝室</if></a>
   </if>
</div>
<include file="commonJS" />
<script>
    $(function(){
        $('.lists').on('click','.iconfont',function(){
	        var status = $(this).data('status') ;
	        var floowId = $(this).data('floow');
	        var ips_id = "{BEESCRM:$ips_id}";
            if($(this).hasClass('icon-guanbi')){
	            status = 0;
                $(this).addClass('icon-controler').removeClass('icon-guanbi');
            }else{
	            status = 1;
                $(this).addClass('icon-guanbi').removeClass('icon-controler');
            }
	        $.ajax({
		        'url': "/base/ips/eleRemindStatus",
		        'data': {floow_id:floowId,status:status,ips_id:ips_id},
		        'dataType':'json',
		        'type': 'GET',
		        'async': false,
		        success: function(data){
			        if(data.status == 'S'){
						$.layeralert(data.message)
			        }else{
						$.layeralert(data.message)
			        }
		        }
	        });
        })
    });
</script>
</body>
</html>